import request from '@/utils/request'


// 查询开账明细列表
// export function getBillDetailDosageList(query) {
//   return request({
//     url: '/datastatistics/billDetail/getBillDetailDosageList',
//     method: 'get',
//     params: query
//   })
// }


// 查询用量数据列表
export function getBillDetailDosageList(query) {
    let baseUrl = '/datastatistics/billDetail/getBillDetailDosageList?frozenType=' + query.frozenType 
          + '&pageNum=' + query.pageNum + '&pageSize=' + query.pageSize
    if (query.sheetsCode != null && query.sheetsCode != '') {
        baseUrl += '&sheetsCode=' + query.sheetsCode
    }
    if (query.userId != null && query.userId != '') {
        baseUrl += '&userId=' + query.userId
    }
    if (query.userName != null && query.userName != '') {
        baseUrl += '&userName=' + query.userName
    }
    if (query.beginTime != null && query.beginTime != '') {
        baseUrl += '&beginTime=' + query.beginTime
    }
    if (query.endTime != null && query.endTime != '') {
        baseUrl += '&endTime=' + query.endTime
    }
    if (query.terminalId != null && query.terminalId != '') {
        baseUrl += '&terminalId=' + query.terminalId
    }
    if (query.locationNb != null && query.locationNb != '') {
      baseUrl += '&locationNb=' + query.locationNb
    }
    if (query.communicateAddress != null && query.communicateAddress != '') {
        baseUrl += '&communicateAddress=' + query.communicateAddress
    }
    if (query.orderByColumn != null) {
        baseUrl += '&orderByColumn=' + query.orderByColumn
    }
    if (query.isAsc != null) {
        baseUrl += '&isAsc=' + query.isAsc
    }
    if (query.energyUseItem != null) {
      baseUrl += '&energyUseItem=' + query.energyUseItem
    }

    if (query.energyUseClassification != null) {
      baseUrl += '&energyUseClassification=' + query.energyUseClassification
    }


    return request({
        url: baseUrl,
        // url: '/datastatistics/terminalXbStatisticAnalysis/DayOrMonth',
        method: 'get',
        // params: query
    })
}






// 查询开账明细列表
export function listBillDetail(query) {
  return request({
    url: '/datastatistics/billDetail/list',
    method: 'get',
    params: query
  })
}

// 查询开账明细详细
export function getBillDetail(id) {
  return request({
    url: '/datastatistics/billDetail/' + id,
    method: 'get'
  })
}

// 新增开账明细
export function addBillDetail(data) {
  return request({
    url: '/datastatistics/billDetail',
    method: 'post',
    data: data
  })
}

// 修改开账明细
export function updateBillDetail(data) {
  return request({
    url: '/datastatistics/billDetail',
    method: 'put',
    data: data
  })
}

// 删除开账明细
export function delBillDetail(id) {
  return request({
    url: '/datastatistics/billDetail/' + id,
    method: 'delete'
  })
}
